package leetcode;

public class Lc3270 {

    public int generateKey(int num1, int num2, int num3) {
        StringBuilder a = new StringBuilder("000").append(num1);
        StringBuilder b = new StringBuilder("000").append(num2);
        StringBuilder c = new StringBuilder("000").append(num3);
        StringBuilder ans = new StringBuilder();
        ans.append((char)Math.min(Math.min(a.charAt(a.length() - 4), b.charAt(b.length() - 4)), c.charAt(c.length() - 4)));
        ans.append((char)Math.min(Math.min(a.charAt(a.length() - 3), b.charAt(b.length() - 3)), c.charAt(c.length() - 3)));
        ans.append((char)Math.min(Math.min(a.charAt(a.length() - 2), b.charAt(b.length() - 2)), c.charAt(c.length() - 2)));
        ans.append((char)Math.min(Math.min(a.charAt(a.length() - 1), b.charAt(b.length() - 1)), c.charAt(c.length() - 1)));
        return Integer.parseInt(ans.toString());
    }

    public static void main(String[] args) {
//        StringBuilder a = new StringBuilder("000").append('c');
//        System.out.printf(a.toString());

        Lc3270 lc3270 = new Lc3270();
        System.out.println(lc3270.generateKey(987, 879, 798));
        System.out.println((char)Math.min('c','d'));

    }

}
